<?php
/**
 * Created by Veyron
 * User: Vy
 * motto:现在的拼搏 为了更好的明天
 * day:  2020/1/13
 * Time: 22:38
 */
namespace app\common\model\mysql;
use think\Model;

class Demo extends Model{
    public function getDemoDataByCategory($category_id,$limit=10){
        $category_id = intval($category_id);
        if(empty($category_id)){
            return [];
        }
        $result = $this->where('category_id',$category_id)
                       ->order('id','desc')
                       ->limit($limit)
                       ->select()
                       ->toArray();
        return $result;
    }
}
